-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2: Propagate panics, add AsyncHandle
#1
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1 +/- ##
===========================================
- Coverage 100.00% 95.45% -4.55%
===========================================
Files 2 3 +1
Lines 20 22 +2
===========================================
+ Hits 20 21 +1
- Misses 0 1 +1
Continue to review full report at Codecov.
|
Coming from the reddit thread - I don't think you need to wrap tokio's RecvError, since it's only a unit error. There's no information in it, so you might as well a) have a unit error type of your own like SpawnFailed or b) just unwrap it, since if you're catching panics it shouldn't ever fail to send something through the channel. |
That's a great point! It could only fail if the sender is dropped, but I'm controlling the sender, so that shouldn't ever happen. I'll just have it return unconditionally then :) Thanks! |
AsyncHandle
and Error
AsyncHandle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't have any panic tests that actually call the spawn method. They all just construct the handle directly.
Fixed! |
@Darksonn @coolreader18 Thanks so much for the feedback! Super helpful :) I'm going to go ahead and merge & release. If there's anything else you notice, feel free to file an issue, and I'll take a look at it 👍 |
Code changes
std::panic
to propagate panics from the thread pool into the async context, rather than triggering the Rayon panic handler.AsyncRayonHandle
type that implementsFuture
, which makes theasync-trait
crate unnecessary.RecvError
. We control theSender
, so it should never be dropped too early.prelude
module.AsyncThreadPool
trait.Repository changes